package com.example.mobile2121606110syc0409homework;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity4 extends AppCompatActivity {

    private TextView tvMainTitle4;
    private TextView tvMainTit41;
    private TextView tvMainTit42;
    private TextView tvMainTit43;
    private EditText edtTtPN4;
    private Button btnMainjs4;
    private TextView tvMainTit44;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main4);
        initView();
        btnMainjs4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                double hua = Double.parseDouble(edtTtPN4.getText().toString());
                double she = 5*(hua - 32)/9;
                tvMainTit44.setText(String.format("%.2f", she));
            }
        });
    }

    private void initView() {
        tvMainTitle4 = (TextView) findViewById(R.id.tvMainTitle4);
        tvMainTit41 = (TextView) findViewById(R.id.tvMainTit41);
        tvMainTit42 = (TextView) findViewById(R.id.tvMainTit42);
        tvMainTit43 = (TextView) findViewById(R.id.tvMainTit43);
        edtTtPN4 = (EditText) findViewById(R.id.edtTtPN4);
        btnMainjs4 = (Button) findViewById(R.id.btnMainjs4);
        tvMainTit44 = (TextView) findViewById(R.id.tvMainTit44);
    }
}